﻿.md-table {
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-surface);
    border-radius: var(--mud-default-borderradius);
    transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;

    &.md-table-square {
        border-radius: 0px;
    }

    &.md-table-outlined {
        border: 1px solid var(--mud-palette-lines-default);
        overflow: hidden;
    }

    th {
        position: relative;
    }

    .md-table-cell {
        .column-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
    }
}
.md-table-container {
    width: 100%;
    overflow-y: auto;
}
.md-table-container-ping-left {
    & .md-table-cell-fix-left-last {
        &::after {
            box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, 0.15);
        }
    }
}
.md-table-container-ping-right {
    & .md-table-cell-fix-right-first {
        &::after {
            box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.15);
        }
    }
}
.md-table-root {
    width: 100%;
    border-spacing: 0;

    & .md-table-head {
        display: table-header-group;
        position: sticky;
        top: 0;
        z-index: 2;

        & .md-table-cell {
            color: var(--mud-palette-text-primary);
            font-weight: 500;
            line-height: 1.5rem;
            background-color: var(--mud-palette-background-gray);
        }
    }

    & .md-table-body {
        display: table-row-group;

        & .md-table-cell {
            color: var(--mud-palette-text-primary);
            background-color: var(--mud-palette-surface);
        }
    }

    > .md-table-body:last-child,
    > .md-table-foot:last-child {
        > .md-table-row:last-child {
            > .md-table-cell {
                border-bottom: none;
            }
        }
    }
}

.md-table-root-fixed {
    table-layout: fixed;
}

.md-table-cell {
    display: table-cell;
    padding: 10px;
    font-size: 0.750rem;
    text-align: start;
    font-weight: 400;
    line-height: 1.43;
    border-bottom: 1px solid var(--mud-palette-table-lines);
    letter-spacing: 0.01071em;
    vertical-align: inherit;
    overflow-wrap: break-word;

    /*& .mud-checkbox {
        margin: -12px;
    }

    & .md-table-row-expander {
        margin: -12px;
        margin-right: 0px;
    }

    & .mud-switch {
        margin: -7px;
    }*/
}
.md-table-cell-fix-left-last::after {
    right: 0;
    bottom: -1px;
    transform: translateX(100%);
    position: absolute;
    width: 30px;
    transition: box-shadow .3s;
    content: '';
    top: 0;
    pointer-events: none;
}
.md-table-cell-fix-right-first::after {
    left: 0;
    bottom: -1px;
    transform: translateX(-100%);
    position: absolute;
    width: 30px;
    transition: box-shadow .3s;
    content: '';
    top: 0;
    pointer-events: none;
}



.md-table-cell-ellipsis {
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
}

.md-table-dense {
    & * .md-table-row {
        & .md-table-cell {
            padding: 6px 24px 6px 16px;
            padding-inline-start: 16px;
            padding-inline-end: 24px;

            .md-table-cell-checkbox {
                .md-button-root {
                    padding: 4px;
                }
            }

            .md-table-row-expander {
                padding: 4px;
            }
        }

        & .md-table-cell:last-child {
            padding-right: 16px;
            padding-inline-end: 16px;
        }
    }
}
.md-table-bordered {
    & .md-table-container .md-table-root .md-table-body {
        & .md-table-row {
            .md-table-cell:not(:last-child) {
                border-right: 1px solid var(--mud-palette-table-lines);
            }
        }
    }

    & .md-table-container .md-table-root .md-table-head.table-head-bordered {
        & .md-table-row {
            .md-table-cell:not(:last-child) {
                border-right: 1px solid var(--mud-palette-table-lines);
            }
        }
    }

    & .md-table-container .md-table-root .md-table-foot.table-foot-bordered {
        & .md-table-row {
            .md-table-cell:not(:last-child) {
                border-right: 1px solid var(--mud-palette-table-lines);
            }
        }
    }
}
.md-table-row {
    color: inherit;
    display: table-row;
    outline: 0;
    vertical-align: middle;
}
.md-table-hover {
    & .md-table-container .md-table-root .md-table-body {
        @media(hover: hover) and (pointer: fine) {
            & .md-table-row:hover {
                background-color: var(--mud-palette-table-hover);
            }
        }
    }
}

.md-table-striped {
    & .md-table-container .md-table-root .md-table-body {
        & .md-table-row:nth-of-type(odd) {
            background-color: var(--mud-palette-table-striped);
        }
    }
}

.md-table-hover.md-table-striped {
    & .md-table-container .md-table-root .md-table-body {
        @media(hover: hover) and (pointer: fine) {
            & .md-table-row:nth-of-type(odd):hover {
                background-color: var(--mud-palette-table-hover);
            }
        }
    }
}

